/*
 * Main.java
 *
 * Created on April 3, 2007, 9:35 AM
 */

package edu.byu.isys413.cbb54.intex2kb.views;
import edu.byu.isys413.cbb54.intex2kb.data.*;

import java.awt.Color;
import java.util.Map;
import java.util.TreeMap;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/**
 *
 * @author  Cameron
 */
public class Main extends javax.swing.JFrame {
    
    private TableModel model;
    public Transaction tx;
    private String empid = null;
    private String storeid = null;
    private Customer cust = null;
    double price = 0.0;
    double subtot = 0.0;
    

    /** Creates new form Main */
    public Main(String empid1, String storeid1, Customer cust1) {
        //        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        
        // Set the selection background to yellow
        UIManager.put("Table.selectionBackground",Color.yellow );
        
        empid = empid1;
        storeid = storeid1;
        cust = cust1;
        
        // Set the look and feel to the system's default
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch(Exception e) {
            System.out.println("Error setting native LAF: " + e);
        }
        
        // Insert the TableModel
        initComponents();
        model = new TableModel();
        jTable1.setModel(model);
        setVisible(8);
        try {
            tx = TransactionDAO.getInstance().create();
            model.updateTable(tx);
            tx.setEmployee(EmployeeDAO.getInstance().read(empid));
            tx.setStore(StoreDAO.getInstance().read(storeid));
            tx.setCustomer(cust);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jPanel5 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        Sale = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        jPanel37 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jPanel36 = new javax.swing.JPanel();
        SaleQty = new javax.swing.JTextField();
        saleSKU = new javax.swing.JTextField();
        jPanel11 = new javax.swing.JPanel();
        submitSale = new javax.swing.JButton();
        Conversion = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jPanel16 = new javax.swing.JPanel();
        destinationTypeInput = new javax.swing.JComboBox();
        numMinutesInput = new javax.swing.JTextField();
        sourceTypeInput = new javax.swing.JComboBox();
        jPanel13 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jPanel14 = new javax.swing.JPanel();
        addConversion = new javax.swing.JButton();
        PrintOrder = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jPanel18 = new javax.swing.JPanel();
        jPanel23 = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jPanel20 = new javax.swing.JPanel();
        sizeInput = new javax.swing.JComboBox();
        paperTypeInput = new javax.swing.JComboBox();
        printTypeInput = new javax.swing.JComboBox();
        numPhotosInput = new javax.swing.JTextField();
        quantityInput = new javax.swing.JTextField();
        jPanel25 = new javax.swing.JPanel();
        jPanel38 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jPanel24 = new javax.swing.JPanel();
        photosetDesc = new javax.swing.JTextArea();
        jPanel19 = new javax.swing.JPanel();
        addPrintOrder = new javax.swing.JButton();
        Backup = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        Rental = new javax.swing.JPanel();
        jPanel26 = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        jPanel30 = new javax.swing.JPanel();
        addRentalItem = new javax.swing.JButton();
        jPanel31 = new javax.swing.JPanel();
        jPanel27 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        serialnumber = new javax.swing.JTextField();
        jPanel28 = new javax.swing.JPanel();
        updateprod = new javax.swing.JButton();
        jPanel29 = new javax.swing.JPanel();
        jPanel34 = new javax.swing.JPanel();
        jPanel32 = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jPanel33 = new javax.swing.JPanel();
        todaysdate = new javax.swing.JTextField();
        priceperday = new javax.swing.JTextField();
        numberdays = new javax.swing.JTextField();
        subtotal = new javax.swing.JTextField();
        jPanel35 = new javax.swing.JPanel();
        calcsubtotal = new javax.swing.JButton();
        Return = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        serialnumber1 = new javax.swing.JTextField();
        addRentalItem1 = new javax.swing.JButton();
        Repair = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        Default = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        table = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        Conv = new javax.swing.JButton();
        PrintO = new javax.swing.JButton();
        Back = new javax.swing.JButton();
        Rent = new javax.swing.JButton();
        Ret = new javax.swing.JButton();
        Rep = new javax.swing.JButton();
        Sal = new javax.swing.JButton();
        pay = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jPanel5.setLayout(new javax.swing.BoxLayout(jPanel5, javax.swing.BoxLayout.X_AXIS));

        jPanel2.setLayout(new java.awt.CardLayout());

        Sale.setLayout(new java.awt.BorderLayout());

        Sale.setBackground(new java.awt.Color(255, 255, 255));
        Sale.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Sale.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Sale.setMinimumSize(new java.awt.Dimension(250, 100));
        Sale.setPreferredSize(new java.awt.Dimension(250, 0));
        jPanel9.setBackground(new java.awt.Color(255, 255, 255));
        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel12.setText("Sale");
        jPanel9.add(jLabel12);

        Sale.add(jPanel9, java.awt.BorderLayout.NORTH);

        jPanel10.setLayout(new javax.swing.BoxLayout(jPanel10, javax.swing.BoxLayout.X_AXIS));

        jPanel10.setBackground(new java.awt.Color(255, 255, 255));
        jPanel37.setBackground(new java.awt.Color(255, 255, 255));
        jLabel17.setText("Quantity");

        jLabel18.setText("SKU");

        org.jdesktop.layout.GroupLayout jPanel37Layout = new org.jdesktop.layout.GroupLayout(jPanel37);
        jPanel37.setLayout(jPanel37Layout);
        jPanel37Layout.setHorizontalGroup(
            jPanel37Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel37Layout.createSequentialGroup()
                .addContainerGap(53, Short.MAX_VALUE)
                .add(jPanel37Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel18)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel17)))
        );
        jPanel37Layout.setVerticalGroup(
            jPanel37Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel37Layout.createSequentialGroup()
                .add(24, 24, 24)
                .add(jLabel18)
                .add(19, 19, 19)
                .add(jLabel17)
                .addContainerGap(236, Short.MAX_VALUE))
        );
        jPanel10.add(jPanel37);

        jPanel36.setBackground(new java.awt.Color(255, 255, 255));
        SaleQty.setFont(new java.awt.Font("Tahoma", 0, 12));
        SaleQty.setText("1");

        saleSKU.setColumns(10);
        saleSKU.setFont(new java.awt.Font("Tahoma", 0, 12));

        org.jdesktop.layout.GroupLayout jPanel36Layout = new org.jdesktop.layout.GroupLayout(jPanel36);
        jPanel36.setLayout(jPanel36Layout);
        jPanel36Layout.setHorizontalGroup(
            jPanel36Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel36Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel36Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(SaleQty, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(saleSKU, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(34, Short.MAX_VALUE))
        );
        jPanel36Layout.setVerticalGroup(
            jPanel36Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel36Layout.createSequentialGroup()
                .add(20, 20, 20)
                .add(saleSKU, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(14, 14, 14)
                .add(SaleQty, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(231, Short.MAX_VALUE))
        );
        jPanel10.add(jPanel36);

        Sale.add(jPanel10, java.awt.BorderLayout.CENTER);

        jPanel11.setBackground(new java.awt.Color(255, 255, 255));
        submitSale.setText("Submit Sale");
        submitSale.setMaximumSize(new java.awt.Dimension(50, 23));
        submitSale.setMinimumSize(new java.awt.Dimension(50, 23));
        submitSale.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitSaleActionPerformed(evt);
            }
        });

        jPanel11.add(submitSale);

        Sale.add(jPanel11, java.awt.BorderLayout.SOUTH);

        jPanel2.add(Sale, "card2");

        Conversion.setLayout(new java.awt.BorderLayout());

        Conversion.setBackground(new java.awt.Color(255, 255, 255));
        Conversion.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Conversion.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Conversion.setMinimumSize(new java.awt.Dimension(250, 0));
        Conversion.setPreferredSize(new java.awt.Dimension(250, 204));
        jPanel12.setLayout(new javax.swing.BoxLayout(jPanel12, javax.swing.BoxLayout.X_AXIS));

        jPanel12.setPreferredSize(new java.awt.Dimension(250, 0));
        jPanel15.setBackground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Number of Minutes:");

        jLabel2.setText("Source Type:");

        jLabel19.setText("Destination Type:");

        org.jdesktop.layout.GroupLayout jPanel15Layout = new org.jdesktop.layout.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel15Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanel15Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel2)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel19)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel3))
                .addContainerGap())
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel15Layout.createSequentialGroup()
                .add(69, 69, 69)
                .add(jLabel2)
                .add(18, 18, 18)
                .add(jLabel19)
                .add(23, 23, 23)
                .add(jLabel3)
                .addContainerGap(113, Short.MAX_VALUE))
        );
        jPanel12.add(jPanel15);

        jPanel16.setBackground(new java.awt.Color(255, 255, 255));
        destinationTypeInput.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "DVD", "CD" }));

        numMinutesInput.setColumns(7);

        sourceTypeInput.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "VHS", "Film" }));

        org.jdesktop.layout.GroupLayout jPanel16Layout = new org.jdesktop.layout.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel16Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(sourceTypeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(destinationTypeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(numMinutesInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(55, Short.MAX_VALUE))
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel16Layout.createSequentialGroup()
                .add(66, 66, 66)
                .add(sourceTypeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(15, 15, 15)
                .add(destinationTypeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(14, 14, 14)
                .add(numMinutesInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(110, Short.MAX_VALUE))
        );
        jPanel12.add(jPanel16);

        Conversion.add(jPanel12, java.awt.BorderLayout.CENTER);

        jPanel13.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Conversion Order");

        org.jdesktop.layout.GroupLayout jPanel13Layout = new org.jdesktop.layout.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );
        Conversion.add(jPanel13, java.awt.BorderLayout.NORTH);

        jPanel14.setBackground(new java.awt.Color(255, 255, 255));
        addConversion.setText("Add to TX");
        addConversion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addConversionActionPerformed(evt);
            }
        });

        jPanel14.add(addConversion);

        Conversion.add(jPanel14, java.awt.BorderLayout.SOUTH);

        jPanel2.add(Conversion, "card5");

        PrintOrder.setLayout(new java.awt.BorderLayout());

        PrintOrder.setBackground(new java.awt.Color(255, 255, 255));
        PrintOrder.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        PrintOrder.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        PrintOrder.setMinimumSize(new java.awt.Dimension(250, 0));
        jPanel17.setBackground(new java.awt.Color(255, 255, 255));
        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("Print Order");
        jPanel17.add(jLabel5);

        PrintOrder.add(jPanel17, java.awt.BorderLayout.NORTH);

        jPanel18.setLayout(new javax.swing.BoxLayout(jPanel18, javax.swing.BoxLayout.Y_AXIS));

        jPanel18.setBackground(new java.awt.Color(255, 255, 255));
        jPanel18.setMinimumSize(new java.awt.Dimension(110, 60));
        jPanel23.setLayout(new javax.swing.BoxLayout(jPanel23, javax.swing.BoxLayout.X_AXIS));

        jPanel23.setBackground(new java.awt.Color(255, 255, 255));
        jPanel21.setBackground(new java.awt.Color(255, 255, 255));
        jPanel21.setPreferredSize(new java.awt.Dimension(125, 160));
        jLabel7.setText("Size:");

        jLabel10.setText("Paper Type:");

        jLabel11.setText("Print Type:");

        jLabel8.setText("Number of Photos:");

        jLabel9.setText("Quantity:");

        org.jdesktop.layout.GroupLayout jPanel21Layout = new org.jdesktop.layout.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel21Layout.createSequentialGroup()
                .addContainerGap(25, Short.MAX_VALUE)
                .add(jPanel21Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel9)
                    .add(jLabel10)
                    .add(jLabel11)
                    .add(jLabel7)
                    .add(jLabel8))
                .addContainerGap())
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel21Layout.createSequentialGroup()
                .add(26, 26, 26)
                .add(jLabel7)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel8)
                .add(14, 14, 14)
                .add(jLabel9)
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPanel23.add(jPanel21);

        jPanel20.setBackground(new java.awt.Color(255, 255, 255));
        jPanel20.setPreferredSize(new java.awt.Dimension(125, 160));
        sizeInput.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "4x6", "5x7" }));

        paperTypeInput.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Matte", "Glossy" }));

        printTypeInput.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Film", "Digital" }));

        numPhotosInput.setColumns(5);

        quantityInput.setColumns(5);

        org.jdesktop.layout.GroupLayout jPanel20Layout = new org.jdesktop.layout.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel20Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel20Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(numPhotosInput)
                    .add(quantityInput)
                    .add(printTypeInput, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(paperTypeInput, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(sizeInput, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(59, Short.MAX_VALUE))
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel20Layout.createSequentialGroup()
                .add(22, 22, 22)
                .add(sizeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(paperTypeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(printTypeInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(numPhotosInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(quantityInput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel23.add(jPanel20);

        jPanel18.add(jPanel23);

        jPanel25.setLayout(new java.awt.BorderLayout());

        jPanel25.setBackground(new java.awt.Color(255, 255, 255));
        jPanel38.setBackground(new java.awt.Color(255, 255, 255));
        jLabel6.setText("PhotoSet Description");
        jPanel38.add(jLabel6);

        jPanel25.add(jPanel38, java.awt.BorderLayout.NORTH);

        jPanel24.setBackground(new java.awt.Color(255, 255, 255));
        jPanel24.setMinimumSize(new java.awt.Dimension(110, 14));
        jPanel24.setPreferredSize(new java.awt.Dimension(50, 14));
        photosetDesc.setColumns(30);
        photosetDesc.setRows(5);
        photosetDesc.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel24.add(photosetDesc);

        jPanel25.add(jPanel24, java.awt.BorderLayout.CENTER);

        jPanel18.add(jPanel25);

        PrintOrder.add(jPanel18, java.awt.BorderLayout.CENTER);

        jPanel19.setBackground(new java.awt.Color(255, 255, 255));
        addPrintOrder.setText("Add to TX");
        addPrintOrder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addPrintOrderActionPerformed(evt);
            }
        });

        jPanel19.add(addPrintOrder);

        PrintOrder.add(jPanel19, java.awt.BorderLayout.SOUTH);

        jPanel2.add(PrintOrder, "card3");

        Backup.setBackground(new java.awt.Color(255, 255, 255));
        Backup.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Backup.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Backup.setMinimumSize(new java.awt.Dimension(250, 0));
        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel13.setText("Backup");

        org.jdesktop.layout.GroupLayout BackupLayout = new org.jdesktop.layout.GroupLayout(Backup);
        Backup.setLayout(BackupLayout);
        BackupLayout.setHorizontalGroup(
            BackupLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(BackupLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel13)
                .addContainerGap(239, Short.MAX_VALUE))
        );
        BackupLayout.setVerticalGroup(
            BackupLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(BackupLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel13)
                .addContainerGap(409, Short.MAX_VALUE))
        );
        jPanel2.add(Backup, "card4");

        Rental.setLayout(new java.awt.BorderLayout());

        Rental.setBackground(new java.awt.Color(255, 255, 255));
        Rental.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Rental.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Rental.setMinimumSize(new java.awt.Dimension(250, 0));
        jPanel26.setBackground(new java.awt.Color(255, 255, 255));
        jLabel24.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel24.setText("Rental");
        jPanel26.add(jLabel24);

        Rental.add(jPanel26, java.awt.BorderLayout.NORTH);

        jPanel30.setBackground(new java.awt.Color(255, 255, 255));
        addRentalItem.setText("Submit");
        addRentalItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addRentalItemActionPerformed(evt);
            }
        });

        jPanel30.add(addRentalItem);

        Rental.add(jPanel30, java.awt.BorderLayout.SOUTH);

        jPanel31.setLayout(new javax.swing.BoxLayout(jPanel31, javax.swing.BoxLayout.Y_AXIS));

        jPanel31.setBackground(new java.awt.Color(255, 255, 255));
        jPanel27.setBackground(new java.awt.Color(255, 255, 255));
        jPanel27.setMaximumSize(new java.awt.Dimension(32767, 40));
        jLabel22.setText("Serial Number");
        jPanel27.add(jLabel22);

        serialnumber.setColumns(10);
        serialnumber.setText("Serial Number");
        jPanel27.add(serialnumber);

        jPanel31.add(jPanel27);

        jPanel28.setBackground(new java.awt.Color(255, 255, 255));
        jPanel28.setMaximumSize(new java.awt.Dimension(32767, 40));
        updateprod.setText("Subtotal");
        updateprod.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateprodActionPerformed(evt);
            }
        });

        jPanel28.add(updateprod);

        jPanel31.add(jPanel28);

        jPanel29.setLayout(new javax.swing.BoxLayout(jPanel29, javax.swing.BoxLayout.Y_AXIS));

        jPanel29.setBackground(new java.awt.Color(255, 255, 255));
        jPanel29.setMaximumSize(new java.awt.Dimension(32869, 100));
        jPanel34.setLayout(new javax.swing.BoxLayout(jPanel34, javax.swing.BoxLayout.X_AXIS));

        jPanel34.setBackground(new java.awt.Color(255, 255, 255));
        jPanel32.setBackground(new java.awt.Color(255, 255, 255));
        jLabel20.setText("Todays Date");

        jLabel14.setText("Price Per Day");

        jLabel21.setText("Number Days Rented");

        jLabel23.setText("Subtotal Due");

        org.jdesktop.layout.GroupLayout jPanel32Layout = new org.jdesktop.layout.GroupLayout(jPanel32);
        jPanel32.setLayout(jPanel32Layout);
        jPanel32Layout.setHorizontalGroup(
            jPanel32Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel32Layout.createSequentialGroup()
                .addContainerGap(47, Short.MAX_VALUE)
                .add(jPanel32Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel23)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel20)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel14)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 102, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel32Layout.setVerticalGroup(
            jPanel32Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel32Layout.createSequentialGroup()
                .add(31, 31, 31)
                .add(jLabel20)
                .add(14, 14, 14)
                .add(jLabel14)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel23)
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel34.add(jPanel32);

        jPanel33.setBackground(new java.awt.Color(255, 255, 255));
        todaysdate.setColumns(10);
        todaysdate.setText("Todays Date");

        priceperday.setColumns(10);
        priceperday.setText("Price per day");

        numberdays.setColumns(10);
        numberdays.setText("Number Days");

        subtotal.setColumns(10);
        subtotal.setText("Subtotal Due");

        org.jdesktop.layout.GroupLayout jPanel33Layout = new org.jdesktop.layout.GroupLayout(jPanel33);
        jPanel33.setLayout(jPanel33Layout);
        jPanel33Layout.setHorizontalGroup(
            jPanel33Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel33Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel33Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(subtotal, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(numberdays, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(priceperday, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(todaysdate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(60, Short.MAX_VALUE))
        );
        jPanel33Layout.setVerticalGroup(
            jPanel33Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel33Layout.createSequentialGroup()
                .add(28, 28, 28)
                .add(todaysdate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(priceperday, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(numberdays, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(subtotal, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel34.add(jPanel33);

        jPanel29.add(jPanel34);

        jPanel35.setBackground(new java.awt.Color(255, 255, 255));
        calcsubtotal.setText("Subtotal");
        calcsubtotal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                calcsubtotalActionPerformed(evt);
            }
        });

        jPanel35.add(calcsubtotal);

        jPanel29.add(jPanel35);

        jPanel31.add(jPanel29);

        Rental.add(jPanel31, java.awt.BorderLayout.CENTER);

        jPanel2.add(Rental, "card6");

        Return.setBackground(new java.awt.Color(255, 255, 255));
        Return.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Return.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Return.setMinimumSize(new java.awt.Dimension(250, 0));
        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel15.setText("Return");

        jLabel25.setText("Serial #");

        serialnumber1.setColumns(10);
        serialnumber1.setText("Serial Number");

        addRentalItem1.setText("Process Return");
        addRentalItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addRentalItem1ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout ReturnLayout = new org.jdesktop.layout.GroupLayout(Return);
        Return.setLayout(ReturnLayout);
        ReturnLayout.setHorizontalGroup(
            ReturnLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(ReturnLayout.createSequentialGroup()
                .add(ReturnLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(ReturnLayout.createSequentialGroup()
                        .add(123, 123, 123)
                        .add(jLabel15))
                    .add(ReturnLayout.createSequentialGroup()
                        .add(78, 78, 78)
                        .add(jLabel25)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(serialnumber1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(ReturnLayout.createSequentialGroup()
                        .add(106, 106, 106)
                        .add(addRentalItem1)))
                .addContainerGap(105, Short.MAX_VALUE))
        );
        ReturnLayout.setVerticalGroup(
            ReturnLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(ReturnLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel15)
                .add(18, 18, 18)
                .add(ReturnLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel25)
                    .add(serialnumber1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(29, 29, 29)
                .add(addRentalItem1)
                .addContainerGap(319, Short.MAX_VALUE))
        );
        jPanel2.add(Return, "card7");

        Repair.setBackground(new java.awt.Color(255, 255, 255));
        Repair.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Repair.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Repair.setMinimumSize(new java.awt.Dimension(250, 0));
        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel16.setText("Repair");

        org.jdesktop.layout.GroupLayout RepairLayout = new org.jdesktop.layout.GroupLayout(Repair);
        Repair.setLayout(RepairLayout);
        RepairLayout.setHorizontalGroup(
            RepairLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(RepairLayout.createSequentialGroup()
                .add(122, 122, 122)
                .add(jLabel16)
                .addContainerGap(135, Short.MAX_VALUE))
        );
        RepairLayout.setVerticalGroup(
            RepairLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(RepairLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel16)
                .addContainerGap(409, Short.MAX_VALUE))
        );
        jPanel2.add(Repair, "card8");

        Default.setBackground(new java.awt.Color(255, 255, 255));
        Default.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        Default.setMaximumSize(new java.awt.Dimension(300, 2147483647));
        Default.setMinimumSize(new java.awt.Dimension(250, 0));
        org.jdesktop.layout.GroupLayout DefaultLayout = new org.jdesktop.layout.GroupLayout(Default);
        Default.setLayout(DefaultLayout);
        DefaultLayout.setHorizontalGroup(
            DefaultLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 316, Short.MAX_VALUE)
        );
        DefaultLayout.setVerticalGroup(
            DefaultLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 442, Short.MAX_VALUE)
        );
        jPanel2.add(Default, "card9");

        jPanel5.add(jPanel2);

        jPanel6.setPreferredSize(new java.awt.Dimension(10, 100));
        org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 10, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 446, Short.MAX_VALUE)
        );
        jPanel5.add(jPanel6);

        getContentPane().add(jPanel5, java.awt.BorderLayout.EAST);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24));
        jLabel1.setText("My Stuff");
        jPanel1.add(jLabel1);

        getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);

        jPanel3.setLayout(new java.awt.BorderLayout());

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        table.setViewportView(jTable1);

        jPanel3.add(table, java.awt.BorderLayout.CENTER);

        jPanel7.setMinimumSize(new java.awt.Dimension(1, 1));
        org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 10, Short.MAX_VALUE)
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 446, Short.MAX_VALUE)
        );
        jPanel3.add(jPanel7, java.awt.BorderLayout.EAST);

        org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 10, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 446, Short.MAX_VALUE)
        );
        jPanel3.add(jPanel8, java.awt.BorderLayout.WEST);

        getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);

        jPanel4.setMinimumSize(new java.awt.Dimension(100, 30));
        jPanel4.setPreferredSize(new java.awt.Dimension(100, 50));
        Conv.setText("Conversion");
        Conv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConvActionPerformed(evt);
            }
        });

        PrintO.setText("PrintOrder");
        PrintO.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PrintOActionPerformed(evt);
            }
        });

        Back.setText("Backup");
        Back.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BackActionPerformed(evt);
            }
        });

        Rent.setText("Rental");
        Rent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RentActionPerformed(evt);
            }
        });

        Ret.setText("Return");
        Ret.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RetActionPerformed(evt);
            }
        });

        Rep.setText("Repair");
        Rep.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RepActionPerformed(evt);
            }
        });

        Sal.setText("Sale");
        Sal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SalActionPerformed(evt);
            }
        });

        pay.setFont(new java.awt.Font("Lucida Grande", 1, 18));
        pay.setText("PAY");
        pay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                payActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .add(36, 36, 36)
                .add(Conv)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(PrintO)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Back)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Rent)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Ret)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Rep)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(Sal)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 176, Short.MAX_VALUE)
                .add(pay)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(Conv)
                    .add(PrintO)
                    .add(Back)
                    .add(Rent)
                    .add(Ret)
                    .add(Rep)
                    .add(Sal)
                    .add(pay))
                .addContainerGap())
        );
        getContentPane().add(jPanel4, java.awt.BorderLayout.SOUTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addRentalItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addRentalItem1ActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_addRentalItem1ActionPerformed
    
    private void submitSaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitSaleActionPerformed
        try{
            Sale s = (Sale)SaleDAO.getInstance().create();
            System.out.println("Created a sale object");
            
            s.setQuantity(Integer.valueOf(SaleQty.getText()));
            System.out.println("Quantity = " + SaleQty.getText());
            
            String id = saleSKU.getText();
            Product p;
            TransactionLine txln;
            
            if(PhysicalDAO.getInstance().exists(id)){
                System.out.print("Creating a Physical Product object.....");
                PhysicalDAO PhyDAO = (PhysicalDAO) PhysicalDAO.getInstance();
                p = PhyDAO.getBySku(id);
                Physical ph = (Physical)p;
                System.out.print("Success");
                s.setPrice(p.getPrice());
                s.setProductType("Serialized");
                s.setProduct(p);
                Conceptual cp = (Conceptual)ConceptualDAO.getInstance().read(ph.getConceptualid());
                
                txln = TransactionLineDAO.getInstance().create(tx, p.getId());
                txln.setRevenueSource(s);
                txln.setRsType("Sale - " + cp.getName());
                tx.addTxLine(txln);
            }else if(ConceptualDAO.getInstance().exists(id)){
                System.out.println("Creating a Conceptual Product object");
                p = ConceptualDAO.getInstance().read(id);
                Conceptual cp = (Conceptual)p;
                s.setPrice(p.getPrice());
                s.setProductType("Bulk");
                s.setProduct(p);
                
                txln = TransactionLineDAO.getInstance().create(tx, p.getId());
                txln.setRevenueSource(s);
                txln.setRsType("Sale - " + cp.getName());
                tx.addTxLine(txln);
            }else{
                throw new Exception();
            }
            
            //Add TX-Line to GUI
            model.updateTable(tx);
            
            // Reset Revenue Source panel
            setVisible(8);
            
            // Reset SKU field
            saleSKU.setText("");
            
        }catch (Exception e){
            JOptionPane.showMessageDialog(null,"There was an error adding item to transaction");
            e.printStackTrace();
        }
    }//GEN-LAST:event_submitSaleActionPerformed
    
    private void updateprodActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateprodActionPerformed
// TODO add your handling code here:
        setrentalinfo();
    }//GEN-LAST:event_updateprodActionPerformed
    
    private void addRentalItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addRentalItemActionPerformed
// TODO add your handling code here:
        try {
            Rental rn = (Rental)RentalDAO.getInstance().create();
            
            //set rental info
            rn.setDateOut(12345678);
            rn.setDateDue(12348765);
            
            
            //set total price
            //conv.setTotalPrice(conv.getQuantity(),ct.getPrice());
            rn.setPrice(subtot);
            
            //create new TX-Line
            TransactionLine txln = TransactionLineDAO.getInstance().create(tx,rn.getId());
            txln.setRevenueSource(rn);
            txln.setRsType("rental");
            tx.addTxLine(txln);
            
            //Add TX-Line to GUI
            model.updateTable(tx);
            
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_addRentalItemActionPerformed
    
    private void calcsubtotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_calcsubtotalActionPerformed
// TODO add your handling code here:
        String numdays = numberdays.getText();
        int days = Integer.parseInt(numdays);
        subtot = days * price;
        subtotal.setText(Double.toString(subtot));
    }//GEN-LAST:event_calcsubtotalActionPerformed
    
    private void payActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_payActionPerformed
        PmtGUI p;
        try {
            p = new PmtGUI(tx, this, model);
            this.setVisible(false);
            p.setVisible(true);
        } catch (DataException ex) {
            System.out.println("There was an error creating a payment");
            ex.printStackTrace();
        }
        
    }//GEN-LAST:event_payActionPerformed
    
    private void addConversionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addConversionActionPerformed
        try {
            conversionBO conv = (conversionBO)ConversionDAO.getInstance().create();
            
            //Read conversionType from DB and create object
            conversionTypeBO ct = conversionTypeDAO.getInstance().getConversionType(sourceTypeInput.getSelectedItem().toString(),destinationTypeInput.getSelectedItem().toString());
            
            //set ConversionOrder attributes
            conv.setConversionType(ct);
            conv.setQuantity(Integer.valueOf(numMinutesInput.getText()));
            
            //set total price
            conv.setTotalPrice(conv.getQuantity(),ct.getPrice());
            
            //create new TX-Line
            TransactionLine txln = TransactionLineDAO.getInstance().create(tx,conv.getId());
            txln.setRevenueSource(conv);
            txln.setRsType("Conversion Order - " + conv.getConversionType().getSourceType() + " -> " + conv.getConversionType().getDestinationType());
            tx.addTxLine(txln);
            
            //Add TX-Line to GUI
            model.updateTable(tx);
            
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_addConversionActionPerformed
    
    private void SalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SalActionPerformed
        setVisible(7);
    }//GEN-LAST:event_SalActionPerformed
    
    private void RepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RepActionPerformed
        setVisible(5);
    }//GEN-LAST:event_RepActionPerformed
    
    private void RetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RetActionPerformed
        setVisible(6);
    }//GEN-LAST:event_RetActionPerformed
    
    private void RentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RentActionPerformed
        setVisible(4);
    }//GEN-LAST:event_RentActionPerformed
    
    private void BackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackActionPerformed
        setVisible(1);
    }//GEN-LAST:event_BackActionPerformed
    
    private void PrintOActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PrintOActionPerformed
        setVisible(3);
    }//GEN-LAST:event_PrintOActionPerformed
    
    private void addPrintOrderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPrintOrderActionPerformed
        try {
            printOrder po = (printOrder)PrintOrderDAO.getInstance().create();
            PhotoSet ps = (PhotoSet)PhotoSetDAO.getInstance().create();
            
            //read printFormat
            printFormat pf = printFormatDAO.getInstance().getPrintFormat(sizeInput.getSelectedItem().toString(),paperTypeInput.getSelectedItem().toString(),printTypeInput.getSelectedItem().toString());
            
            //set PrintOrder values
            po.setPOID(GUID.generate());
            po.setPrintFormat(pf);
            po.setQuantity(Integer.valueOf(quantityInput.getText()));
            
            //set PhotoSet values
            ps.setDescription(photosetDesc.getText());
            System.out.println(photosetDesc.getText());
            ps.setNumPhotos(Integer.valueOf(numPhotosInput.getText()));
            po.setPhotoSet(ps);
            
            //set total price in RSBO
            po.setTotalPrice(po.getQuantity(),pf.getPrice(),ps.getNumPhotos());
            
            //Create TX-Line
            TransactionLine txln = TransactionLineDAO.getInstance().create(tx,po.getId());
            txln.setRevenueSource(po);
            txln.setRsType("Print Order - " + po.getPhotoSet().getDescription());
            tx.addTxLine(txln);
            
            //Add TX-Line to GUI
            model.updateTable(tx);
            
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_addPrintOrderActionPerformed
    
    private void ConvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConvActionPerformed
        setVisible(2);
    }//GEN-LAST:event_ConvActionPerformed
    
    public void setrentalinfo(){
        try{
            String serial = serialnumber.getText();
            
            //serialnumber.setText(serial);
            String physicalid = ForRentDAO.getInstance().getBySerial(serial);
            //PhysicalDAO.getInstance().read();
            ConceptualRental cr = ConceptualRentalDAO.getInstance().read("214ra3q4wrae");
            price = cr.getPrice();
            priceperday.setText(Double.toString(price));
            todaysdate.setText("April 4th");
            
            
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     * @param args the command line arguments
     */
    /*public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Main().setVisible(true);
            }
        });
    }*/
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Back;
    private javax.swing.JPanel Backup;
    private javax.swing.JButton Conv;
    private javax.swing.JPanel Conversion;
    private javax.swing.JPanel Default;
    private javax.swing.JButton PrintO;
    private javax.swing.JPanel PrintOrder;
    private javax.swing.JButton Rent;
    private javax.swing.JPanel Rental;
    private javax.swing.JButton Rep;
    private javax.swing.JPanel Repair;
    private javax.swing.JButton Ret;
    private javax.swing.JPanel Return;
    private javax.swing.JButton Sal;
    private javax.swing.JPanel Sale;
    private javax.swing.JTextField SaleQty;
    private javax.swing.JButton addConversion;
    private javax.swing.JButton addPrintOrder;
    private javax.swing.JButton addRentalItem;
    private javax.swing.JButton addRentalItem1;
    private javax.swing.JButton calcsubtotal;
    private javax.swing.JComboBox destinationTypeInput;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel30;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel32;
    private javax.swing.JPanel jPanel33;
    private javax.swing.JPanel jPanel34;
    private javax.swing.JPanel jPanel35;
    private javax.swing.JPanel jPanel36;
    private javax.swing.JPanel jPanel37;
    private javax.swing.JPanel jPanel38;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField numMinutesInput;
    private javax.swing.JTextField numPhotosInput;
    private javax.swing.JTextField numberdays;
    private javax.swing.JComboBox paperTypeInput;
    private javax.swing.JButton pay;
    private javax.swing.JTextArea photosetDesc;
    private javax.swing.JTextField priceperday;
    private javax.swing.JComboBox printTypeInput;
    private javax.swing.JTextField quantityInput;
    private javax.swing.JTextField saleSKU;
    private javax.swing.JTextField serialnumber;
    private javax.swing.JTextField serialnumber1;
    private javax.swing.JComboBox sizeInput;
    private javax.swing.JComboBox sourceTypeInput;
    private javax.swing.JButton submitSale;
    private javax.swing.JTextField subtotal;
    private javax.swing.JScrollPane table;
    private javax.swing.JTextField todaysdate;
    private javax.swing.JButton updateprod;
    // End of variables declaration//GEN-END:variables
    
    private void setVisible(int num){
        switch(num){
            case 1:
                Backup.setVisible(true);
                Conversion.setVisible(false);
                PrintOrder.setVisible(false);
                Rental.setVisible(false);
                Repair.setVisible(false);
                Return.setVisible(false);
                Sale.setVisible(false);
                Default.setVisible(false);
                break;
            case 2:
                Backup.setVisible(false);
                Conversion.setVisible(true);
                PrintOrder.setVisible(false);
                Rental.setVisible(false);
                Repair.setVisible(false);
                Return.setVisible(false);
                Sale.setVisible(false);
                Default.setVisible(false);
                break;
            case 3:
                Backup.setVisible(false);
                Conversion.setVisible(false);
                PrintOrder.setVisible(true);
                Rental.setVisible(false);
                Repair.setVisible(false);
                Return.setVisible(false);
                Sale.setVisible(false);
                Default.setVisible(false);
                break;
            case 4:
                Backup.setVisible(false);
                Conversion.setVisible(false);
                PrintOrder.setVisible(false);
                Rental.setVisible(true);
                Repair.setVisible(false);
                Return.setVisible(false);
                Sale.setVisible(false);
                Default.setVisible(false);
                break;
            case 5:
                Backup.setVisible(false);
                Conversion.setVisible(false);
                PrintOrder.setVisible(false);
                Rental.setVisible(false);
                Repair.setVisible(true);
                Return.setVisible(false);
                Sale.setVisible(false);
                Default.setVisible(false);
                break;
            case 6:
                Backup.setVisible(false);
                Conversion.setVisible(false);
                PrintOrder.setVisible(false);
                Rental.setVisible(false);
                Repair.setVisible(false);
                Return.setVisible(true);
                Sale.setVisible(false);
                Default.setVisible(false);
                break;
            case 7:
                Backup.setVisible(false);
                Conversion.setVisible(false);
                PrintOrder.setVisible(false);
                Rental.setVisible(false);
                Repair.setVisible(false);
                Return.setVisible(false);
                Sale.setVisible(true);
                Default.setVisible(false);
                break;
            default:
                Backup.setVisible(false);
                Conversion.setVisible(false);
                PrintOrder.setVisible(false);
                Rental.setVisible(false);
                Repair.setVisible(false);
                Return.setVisible(false);
                Sale.setVisible(false);
                Default.setVisible(true);
                break;
        }
    }
}
